import turtle as t
def drawgap():
    t.pu()
    t.fd(5)
def drawline(draw):#绘制单段数码管
    t.pendown() if draw else t.penup()
    t.fd(40)
    drawgap()
    t.right(90)
def drawdigit(digit):#根据数值绘制七段数码管
    drawline(True) if digit in [2,3,4,5,6,8,9] else drawline(False)
    drawline(True) if digit in [0,1,3,4,5,6,7,8,9] else drawline(False)
    drawline(True) if digit in [0,2,3,5,6,8,9] else drawline(False)
    drawline(True) if digit in [0,2,6,8] else drawline(False)
    t.left(90)
    drawline(True) if digit in [0,4,5,6,8,9] else drawline(False)
    drawline(True) if digit in [0,2,3,5,6,7,8,9] else drawline(False)

    drawline(True) if digit in [0,1,2,3,4,7,8,9] else drawline(False)
    t.left(180)
    t.pu()#为绘制后续数字确定位置
    t.fd(20)#为绘制后续数字确定位置
def drawdate(date):#获取日期
    t.pencolor("green")
    for i in date:
        if i == '年':
            t.write('年', font=("Arial", 18, "normal"))
            t.pencolor("blue")
            t.fd(40)
        elif i == "月":
            t.write('月', font=("Arial", 18, "normal"))
            t.pencolor("yellow")
            t.fd(40)
        elif i == "日":
            t.write('日', font=("Arial", 18, "normal"))
            t.pencolor("red")
        else:
            drawdigit(eval(i))  # 通过eval()将数字变成整数


def main(date):
    t.setup(800, 350, 200, 200)
    t.pu()
    t.fd(-300)
    t.pensize(5)
    t.color("red")
    drawdate(date)
    t.hideturtle()
    t.done()


main(input("请输入一个年月日，例：2019年01月22日:\n"))